home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / pc / Demos / Bombardier_PC / BSCRIPTS.CST / 00110_Script_returnToQTVRfield < prev    next >
Text File  |  1999-04-25  |  4KB  |  138 lines

  1. -- ⌐ 1998 @radical.media, inc. & Concurrent New Media Group, L.L.C.
  2. -- Developed for Bombardier, Inc.
  3. --
  4. -- All programming developed by: 
  5. -- Robert Fabricant, Valerie Valoueva, Ossi Shaked, 
  6. -- Henry Sauvageot, Chris Howell & Chris Girand
  7. --
  8. -- Use of this code by parties other than @radical.media, inc. or their
  9. --agents 
  10. -- without the express written consent of @radical.media, inc. AND Concurrent 
  11. -- New Media Group, L.L.C. is strictly prohibited.
  12. ------------------------------------------------------
  13.  
  14. --Each "return to aircraft" button consists of two elements: #bmp "Picture" and #richText "Field". Both elements are linked and should be percieved by user as a whole: one element's rollover triggers the other element's rollover. This script is a "Field"'s behavior .
  15.  
  16. property mySprite, neutralName, HiliteButtonName, NeutralButtonName,buttonSprite, myRect
  17. global comeFromQTVR, gRtrnPln, retFrame
  18.  
  19.  
  20. on new me
  21.   global returnSoundPlayed --sound trigger
  22.   -- Button is only visible if this detail was 
  23.   -- navigated from a QTVR interior or exterior sections
  24.   if comeFromQTVR then
  25.     set mySprite = the spriteNum of me
  26.     set fieldIsHilited = FALSE
  27.     set neutralName = "r_field"
  28.     
  29.     --figure out "Picture"'s sprite number and  cast 
  30.     --members name since "field"'s rollovers also have to change "Picture"'s graphics
  31.     set neutralButtonName = getNeuButtonName (me)
  32.     set HiliteButtonName = neutralButtonName & "-hil"
  33.     set buttonSprite = mySprite+1
  34.     set the member of sprite mySprite = member neutralName
  35.     
  36.     --Rollover sound effect shouldn't play again 
  37.     --if mouse leaves "field" and rolles over "Picture" 
  38.     --and vice versa. Boundaries between "field" and "Picture" 
  39.     --sould be seamless. The following code calculates an 
  40.     --imaginary rectangle around the button to set the sound 
  41.     --trigger off if mouse is within that rectangle.
  42.     set textWidth = the width of member neutralName
  43.     set textHeight = the height of member neutralName
  44.     set butWidth = the width of member neutralButtonName
  45.     set butHeight = the height of member neutralButtonName
  46.     if the left of sprite mySprite > the left of sprite buttonSprite then
  47.       set startH = the left of sprite buttonSprite - butWidth/2 
  48.       set startV = the top of sprite buttonSprite - butHeight/2
  49.       
  50.     else
  51.       set startH = the left of sprite mySprite 
  52.       set startV = the top of sprite mySprite
  53.       
  54.     end if
  55.     set startPoint = point(startH,startV)
  56.     set endH = startH + butWidth + textWidth
  57.     set endV = startV + max(butHeight,textHeight)
  58.     set endPoint = point(endH,endV)
  59.     set myRect = rect(startPoint,endPoint)
  60.     
  61.     
  62.     set returnSoundPlayed = FALSE
  63.     --    put myRect
  64.   end if
  65.   
  66.   
  67. end
  68.  
  69.  
  70.  
  71. on exitFrame me 
  72.   global returnSoundPlayed
  73.   if comeFromQTVR then
  74.     set mouseLoc = point(the mouseH, the mouseV)
  75.     if inside (mouseLoc,myRect) then
  76.       if not returnSoundPlayed then
  77.         puppetsound 3, "subRollOld"
  78.         set returnSoundPlayed = TRUE
  79.       end if
  80.     else
  81.       set returnSoundPlayed = FALSE
  82.     end if
  83.   end if
  84.   
  85.   
  86. end
  87.  
  88.  
  89.  
  90.  
  91. on mouseEnter me
  92.   if comeFromQTVR then
  93.     
  94.     set the member of sprite buttonSprite = member  HiliteButtonName 
  95.   end if
  96.   
  97. end
  98.  
  99. on mouseLeave me
  100.   if comeFromQTVR then
  101.     
  102.     set the member of sprite buttonSprite= member  NeutralButtonName
  103.     
  104.     
  105.   end if
  106.   
  107. end
  108.  
  109. on mouseUp me
  110.   if comeFromQTVR then
  111.     if gRtrnPln = "EXT" then --if came from the QTVR exterior 
  112.       go to retFrame
  113.     else
  114.       go to frame "qtvr" --if came from the QTVR interior 
  115.     end if
  116.     
  117.     puppetsound 3, "mouse5"
  118.   end if
  119.   cursor -1
  120. end
  121.  
  122.  
  123. on getNeuButtonName me
  124.    set Name = neutralName
  125.   repeat with i = the Number of Chars of Name down to 1
  126.     if char i of Name <> "_" then 
  127.       delete char i of Name
  128.     else
  129.       delete char i of Name
  130.       exit repeat
  131.     end if
  132.   end repeat
  133.   return Name
  134. end
  135.  
  136.  
  137.  
  138.